package com.tfswx.jkgl.core.cscl;

import cn.hutool.core.util.IdUtil;
import com.tfswx.jkgl.core.cscl.base.CsclBase;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

/**
 * @author ricky
 * @date 2021/12/17
 */
@Component
public class Uuid32 implements CsclBase {
    @Override
    public String getName() {
        return "32位大写UUID";
    }

    @Override
    public boolean sfxycs() {
        return false;
    }

    @Override
    public Object encode(Object value, Object jmcs, String pBds, String id) {
        if (value == null) {
            return IdUtil.fastSimpleUUID().toUpperCase();
        }
        if (StringUtils.isBlank(value.toString())) {
            return IdUtil.fastSimpleUUID().toUpperCase();
        }
        return value;
    }
}
